package xyz.zhouzhousag.controller;
/**
 * Description:
 * <p>
 * ClassName: AccountController
 * date: 2021/2/25 16:05
 *
 * @author Yin.Liu
 * @version 1.0
 * @since JDK 1.8
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import xyz.zhouzhousag.domain.Account;
import xyz.zhouzhousag.service.IAccountService;

import java.util.List;

/**
 *@ClassName AccountController
 *@Description TODO
 *@Author Yin.Liu8
 *@Date 2021/2/25 16:05
 *@Version 1.0
 */
@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private IAccountService accountService;

    @RequestMapping("/findAll")
    public String findAll(Model model){
        System.out.println("表现层：查询所有账户信息");
        List<Account> all = accountService.findAll();
        model.addAttribute("list",all);
        return "list";
    }
    @RequestMapping("/save")
    public String save(Account account){
        System.out.println("表现层：保存账户信息");
        accountService.saveAccount(account);
        return "list";
    }
}
